package org.cosmact.designer.vxml.gefeditor.editor;

import org.apache.log4j.Logger;
import org.cosmact.vxml.model.Dialog;
import org.cosmact.vxml.model.ModelFactory;
import org.eclipse.gef.requests.CreationFactory;

public class ModelCreationFactory implements CreationFactory {
	
	Logger logger = Logger.getLogger(ModelCreationFactory.class);

	private Class<?> objectType;

	public ModelCreationFactory(Class<?> type) {
		this.objectType = type;
	}

	@Override
	public Object getNewObject() {
		if (objectType == Dialog.class) {
			return ModelFactory.eINSTANCE.createDialog();
		}

		logger.info("Can't create object for class " + objectType);
		return null;
	}

	@Override
	public Object getObjectType() {
		return objectType;
	}

}